home *** CD-ROM | disk | FTP | other *** search
- 0 rem << cd41-9 >>
- 1 rem ==================================
- 2 rem commodares problem #37-4 :
- 3 rem phrase reverser
- 4 rem solution by
- 5 rem paul parker
- 6 rem ==================================
- 9 rem --- novice solution ---
- 10 input"[147]phrase";s$:fora=len(s$)to1step-1:r$=r$+mid$(s$,a,1):next:printr$
- 20 print"type - run 110 - for expert solution" : stop
- 100 rem --- expert solution ---
- 110 input"word(s) to reverse";s$
- 120 fora=1tolen(s$):r$=mid$(s$,a,1):ifr$=" "then 140
- 130 sr$=sr$+r$ : next a
- 140 for b=len(sr$)to1step-1:printmid$(sr$,b,1);:next:print" ";:sr$=""
- 150 if a>len(s$) then end
- 160 next
-